package edu.xhu.video.feign;

import edu.xhu.model.common.dtos.ResponseResult;
import edu.xhu.video.service.BiliVideoCrudService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "BiliVideoCrudApi", tags = "BiliVideoCrudApi")
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/bilivideo")
public class BiliVideoCrudApi {
    private final BiliVideoCrudService biliVideoCrudService;

    /**
     * 获取全部视频id
     */
    @ApiOperation("获取全部视频id")
    @GetMapping("/getAllVideoIds")
    ResponseResult<?> getAllVideoIds() {
        return biliVideoCrudService.getAllVideoIds();
    }

    /**
     * 根据videoIds,对所有video的弹幕数量+1
     */
    @ApiOperation("根据ids更新视频弹幕")
    @GetMapping("/updateDanmu")
    ResponseResult<?> updateDanmuByVideoIds(List<Long> videoIds){
        return biliVideoCrudService.updateDanmuByVideoIds(videoIds);
    }

}
